<script type="text/javascript">
$(document).ready(function()
				{
					$(".text2").blur(function(){
						$cellvalue = $(".cellvalue").val();
						$tong =$('.tong'+$(this).get(0).id).val();
						$value=$(this).val();
						$cellvalue = parseInt($cellvalue,10);
						$tong =parseInt($tong,10);
						$value=parseInt($value,10);
						if (isNaN($cellvalue))
							$cellvalue=0;
						if (isNaN($tong))
							$tong=0;
						if (isNaN($value))
						{
							$value=0;
							$(this).val(0);
						}
						$tong = $tong + $value - $cellvalue;
						$('.tong'+$(this).get(0).id).val($tong);
					});
				
				$(".text2").focus(function(){
				$(".cellvalue").val($(this).val());
				});
				
				$(".text1").keydown(function(e) {
					arr_key = new Array();
					arr_key[8]=8;
					arr_key[9]=9;
					arr_key[35]=35;
					arr_key[36]=36;
					arr_key[37]=37;
					arr_key[39]=39;
					arr_key[46]=46;
			        if ( arr_key[e.keyCode]!==undefined) {}
				else {
				if (e.keyCode < 48 || e.keyCode > 57 ) {
				e.preventDefault(); 
				}   
				}
				});
				$(".text2").keydown(function(e) {
					arr_key = new Array();
					arr_key[8]=8;
					arr_key[9]=9;
					arr_key[35]=35;
					arr_key[36]=36;
					arr_key[37]=37;
					arr_key[39]=39;
					arr_key[46]=46;
			        if ( arr_key[e.keyCode]!==undefined) {}
				else {
				if (e.keyCode < 48 || e.keyCode > 57 ) {
				e.preventDefault(); 
				}   
				}
				});
				}
	);

</script>
<div id="tabs">
	<ul>
        <li><?php echo $this->Html->link(__('Xem chỉ tiêu', true), array('controller' => 'chitieudvs', 'action' => 'hienchitieu',$kehoach_id)); ?> </li>
        <li id="current"><?php echo $this->Html->link(__('Sửa số lượng', true), array('controller'=>'chitieudvs','action' => 'suachitieu',$kehoach_id));?></li>
        <li><?php echo $this->Html->link(__('Các thời gian giao khác', true), array('controller'=>'kehoaches','action' => 'giaochitieu',$this->Session->read('cur_cha')));?></li>
	</ul>
</div>
<div class="index">

<?php
if (isset($donvi) && isset($hanghoa)&& isset($data1)&& isset($data_id1)&& isset($data2)&& isset($data_id2))
{
	echo $this->Form->create('Chitieudv',array('url'=>'luuchitieu/'.$kehoach_id));
 ?>
<?php
	echo "</br><h3>Sửa số lượng các Chỉ Tiêu Cho Trung Tâm</h3>".'<b>Từ:</b> '.date('d-m-Y',strtotime(key($thoigian))) . '  <b>Đến:</b> '. date('d-m-Y',strtotime($thoigian[key($thoigian)]));
    	echo $ctable->edit_2_table('Chitieudv', $col1, $donvi, $hanghoa, $data1, $data_id1, $data2, $data_id2);
?>
<?php 
echo $this->Form->end(__('  Lưu  ', true));
}
else 
	echo "<h2>Trung Tâm Chưa Lập Chỉ Tiêu </h2>";
?>

</div>